{extend name="base/layer_layout" /}


{block name="body"}
<article class="cl pd-20">
    <form action="{:url('admin/AdminMenu/save')}" method="post" class="form form-horizontal" id="form-admin-edit">
        <input type="hidden" name="id" value="{$info.id|default=0}">
        <input type="hidden" name="pid" value="{$info.pid|default=0}">
        <input type="hidden" name="root_id" value="{$info.root_id|default=0}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="菜单名称" id="title" name="title" value="{$info.title|default=''}">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="菜单地址" name="url" id="url" value="{$info.url|default=''}">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">提示：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="{$info.tip|default=''}" placeholder="提示" id="tip" name="tip">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">分组：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off"  placeholder="分组" id="group" name="group" value="{$info.group|default=''}">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>是否隐藏	：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="hide" type="radio" id="hide_1" value="1" {eq name="info.hide" value="1"}checked{/eq} >
                    <label for="hide_1">是</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="hide_2" value="0" name="hide" {eq name="info.hide" value="0"}checked{/eq}>
                    <label for="hide_2">否</label>
                </div>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">菜单类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:200px;">
				<select class="select" name="menu_type">
                    {empty name="info.menu_type"}
                    <option value="0">---请选择---</option>
                    {/empty}
                    {volist name=":config('menu_type')" id="vo"}
                    {gt name="info.pid" value="0"}
                        {eq name="key" value="1"}
                            {continue}
                        {else}
					        <option value="{$key}" {eq name="info.menu_type" value="$key"}selected{/eq} >{$vo}</option>
                        {/eq}
                    {else}
                        {eq name="key" value="1"}
                            <option value="{$key}" {eq name="info.menu_type" value="$key"}selected{/eq} >{$vo}</option>
                        {else}
					        {continue}
                        {/eq}
                    {/gt}
                    {/volist}
				</select>
				</span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>是否仅开发者模式可见	：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="is_dev" type="radio" id="is_dev_1" value="1" {eq name="info.is_dev" value="1"}checked{/eq} >
                    <label for="is_dev_1">是</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="is_dev_2" value="0" name="is_dev" {eq name="info.is_dev" value="0"}checked{/eq}>
                    <label for="is_dev_2">否</label>
                </div>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">排序：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off"  placeholder="排序" id="sort" name="sort" value="{$info.sort|default='0'}">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
{/block}

{block name="script"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__EXP_PLUGIN__/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__EXP_PLUGIN__/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__EXP_PLUGIN__/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form-admin-edit").validate({
            rules:{
                title:{
                    required:true,
                    minlength:2,
                    maxlength:100
                },
                url:{
                    required:true,
                    minlength:2,
                    maxlength:100
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit(function (result) {
                    layer.msg(result.msg);
                    if (result.code == 1) {
                        setTimeout(function () {
                            window.parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.$('.btn-refresh').click();
                            parent.layer.close(index);
                        }, 1500);
                    }
                });
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}